home *** CD-ROM | disk | FTP | other *** search
/ PC Basics 53 / PC Basics Issue 53.iso / Software / Internet / Invboard.exe / PC Basics 53 / Invboard / upload / index.php < prev    next >
Encoding:
PHP Script  |  2002-08-01  |  7.9 KB  |  286 lines

  1. <?php
  2.  
  3. /*
  4. +--------------------------------------------------------------------------
  5. |   IBFORUMS v1
  6. |   ========================================
  7. |   by Matthew Mecham and David Baxter
  8. |   (c) 2001,2002 IBForums
  9. |   http://www.ibforums.com
  10. |   ========================================
  11. |   Web: http://www.ibforums.com
  12. |   Email: phpboards@ibforums.com
  13. |   Licence Info: phpib-licence@ibforums.com
  14. +---------------------------------------------------------------------------
  15. |
  16. |   > Wrapper script
  17. |   > Script written by Matt Mecham
  18. |   > Date started: 14th February 2002
  19. |
  20. +--------------------------------------------------------------------------
  21. */
  22.  
  23. //-----------------------------------------------
  24. // USER CONFIGURABLE ELEMENTS
  25. //-----------------------------------------------
  26.  
  27. // Root path
  28.  
  29. $root_path = "./";
  30.  
  31. //-----------------------------------------------
  32. // NO USER EDITABLE SECTIONS BELOW
  33. //-----------------------------------------------
  34.  
  35. error_reporting  (E_ERROR | E_WARNING | E_PARSE);
  36. set_magic_quotes_runtime(0);
  37.  
  38. class Debug {
  39.     function startTimer() {
  40.         global $starttime;
  41.         $mtime = microtime ();
  42.         $mtime = explode (' ', $mtime);
  43.         $mtime = $mtime[1] + $mtime[0];
  44.         $starttime = $mtime;
  45.     }
  46.     function endTimer() {
  47.         global $starttime;
  48.         $mtime = microtime ();
  49.         $mtime = explode (' ', $mtime);
  50.         $mtime = $mtime[1] + $mtime[0];
  51.         $endtime = $mtime;
  52.         $totaltime = round (($endtime - $starttime), 5);
  53.         return $totaltime;
  54.     }
  55. }
  56.  
  57. class info {
  58.  
  59.     var $member     = array();
  60.     var $input      = array();
  61.     var $session_id = "";
  62.     var $base_url   = "";
  63.     var $vars       = "";
  64.     var $skin_id    = "0";     // Skin Dir name
  65.     var $skin_rid   = "";      // Real skin id (numerical only)
  66.     var $lang_id    = "en";
  67.     var $skin       = "";
  68.     var $lang       = "";
  69.     var $server_load = 0;
  70.     var $version    = "v1.0.1";
  71.     var $lastclick  = "";
  72.     var $location   = "";
  73.  
  74.     function info() {
  75.         global $sess, $std, $DB, $root_path, $INFO;
  76.         
  77.         $this->vars = &$INFO;
  78.         
  79.         $this->vars['TEAM_ICON_URL']   = $INFO['html_url'] . '/team_icons';
  80.         $this->vars['AVATARS_URL']     = $INFO['html_url'] . '/avatars';
  81.         $this->vars['EMOTICONS_URL']   = $INFO['html_url'] . '/emoticons';
  82.         $this->vars['mime_img']        = $INFO['html_url'] . '/mime_types';
  83.  
  84.     }
  85. }
  86.  
  87. //--------------------------------
  88. // Import $INFO, now!
  89. //--------------------------------
  90.  
  91. require $root_path."conf_global.php";
  92.  
  93. //--------------------------------
  94. // The clocks a' tickin'
  95. //--------------------------------
  96.         
  97. $Debug = new Debug;
  98. $Debug->startTimer();
  99.  
  100. //--------------------------------
  101. // Require our global functions
  102. //--------------------------------
  103.  
  104. require $root_path."sources/functions.php";
  105.  
  106. $std   = new FUNC;
  107. $print = new display();
  108. $sess  = new session();
  109.  
  110. //--------------------------------
  111. // Load the DB driver and such
  112. //--------------------------------
  113.  
  114. $INFO['sql_driver'] = !$INFO['sql_driver'] ? 'mySQL' : $INFO['sql_driver'];
  115.  
  116. $to_require = $root_path."sources/Drivers/".$INFO['sql_driver'].".php";
  117. require ($to_require);
  118.  
  119. $DB = new db_driver;
  120.  
  121. $DB->obj['sql_database']     = $INFO['sql_database'];
  122. $DB->obj['sql_user']         = $INFO['sql_user'];
  123. $DB->obj['sql_pass']         = $INFO['sql_pass'];
  124. $DB->obj['sql_host']         = $INFO['sql_host'];
  125. $DB->obj['sql_tbl_prefix']   = $INFO['sql_tbl_prefix'];
  126.  
  127. // Get a DB connection
  128.  
  129. $DB->connect();
  130.  
  131. //--------------------------------
  132. // Wrap it all up in a nice easy to
  133. // transport super class
  134. //--------------------------------
  135.  
  136. $ibforums             = new info();
  137.  
  138. //--------------------------------
  139. //  Set up our vars
  140. //--------------------------------
  141.  
  142. $ibforums->input      = $std->parse_incoming();
  143. $ibforums->member     = $sess->authorise();
  144. $ibforums->skin       = $std->load_skin();
  145. $ibforums->lastclick  = $sess->last_click;
  146. $ibforums->location   = $sess->location;
  147. $ibforums->session_id = $sess->session_id;
  148.  
  149. if ($ibforums->member['id'] and ( $std->my_getcookie('hide_sess') ) )
  150. {
  151.     $ibforums->session_id = "";
  152. }
  153.  
  154. $ibforums->base_url   = $ibforums->vars['board_url'].'/index.'.$ibforums->vars['php_ext'].'?s='.$ibforums->session_id;
  155.  
  156. $ibforums->skin_rid   = $ibforums->skin['set_id'];
  157. $ibforums->skin_id    = 's'.$ibforums->skin['set_id'];
  158.  
  159. $ibforums->vars['img_url']   = 'style_images/' . $ibforums->skin['img_id'];
  160.  
  161. //--------------------------------
  162. //  Set up our language choice
  163. //--------------------------------
  164.  
  165. $ibforums->lang_id = $ibforums->member['language'] ? $ibforums->member['language'] : 'en';
  166.  
  167. if ( ($ibforums->lang_id != 'en') and (! is_dir( $root_path."lang/".$ibforums->lang_id ) ) )
  168. {
  169.     $ibforums->lang_id = 'en';
  170. }
  171.  
  172. require $root_path."lang/".$ibforums->lang_id."/lang_global.php";
  173.         
  174. $ibforums->lang = $lang;
  175.  
  176. unset($lang);
  177.  
  178. //--------------------------------
  179.  
  180. require $root_path."Skin/".$ibforums->skin_id."/skin_global.php";
  181.  
  182. $skin_universal = new skin_global();
  183.  
  184. //--------------------------------
  185.  
  186. if ($ibforums->input['act'] != 'Login' and $ibforums->input['act'] != 'Reg' and $ibforums->input['act'] != 'Attach')
  187. {
  188.  
  189.     //--------------------------------
  190.     //  Do we have permission to view
  191.     //  the board?
  192.     //--------------------------------
  193.     
  194.     if ($ibforums->member['g_view_board'] != 1)
  195.     {
  196.         $std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_view_board') );
  197.     }
  198.     
  199.     //--------------------------------
  200.     //  Is the board offline?
  201.     //--------------------------------
  202.     
  203.     if ($ibforums->vars['board_offline'] == 1)
  204.     {
  205.         if ($ibforums->member['g_access_offline'] != 1)
  206.         {
  207.             $std->board_offline();
  208.         }
  209.         
  210.     }
  211.     
  212.     //--------------------------------
  213.     //  Is log in enforced?
  214.     //--------------------------------
  215.     
  216.     if ( (! $ibforums->member['id']) and ($ibforums->vars['force_login'] == 1) )
  217.     {
  218.         require $root_path."sources/Login.php";
  219.         
  220.     }
  221.  
  222. }
  223.  
  224. //--------------------------------
  225. // Decide what to do
  226. //--------------------------------
  227.  
  228. $choice = array(
  229.                  "idx"      => "Boards",
  230.                  "SF"       => "Forums",
  231.                  "SR"       => "Forums",
  232.                  "ST"       => "Topics",
  233.                  "Login"    => "Login",
  234.                  "Post"     => "Post",
  235.                  "Poll"     => "lib/add_poll",
  236.                  "Reg"      => "Register",
  237.                  "Online"   => "Online",
  238.                  "Members"  => "Memberlist",
  239.                  "Help"     => "Help",
  240.                  "Search"   => "Search",
  241.                  "Mod"      => "Moderate",
  242.                  "Print"    => "misc/print_page",
  243.                  "Forward"  => "misc/forward_page",
  244.                  "Mail"     => "misc/contact_member",
  245.                  "Invite"   => "misc/contact_member",
  246.                  "ICQ"      => "misc/contact_member",
  247.                  "AOL"      => "misc/contact_member",
  248.                  "Msg"      => "Messenger",
  249.                  "UserCP"   => "Usercp",
  250.                  "Profile"  => "Profile",
  251.                  "Track"    => "misc/tracker",
  252.                  "Stats"    => "misc/stats",
  253.                  "Attach"   => "misc/attach",
  254.                  'ib3'      => 'misc/ib3',
  255.                  'legends'  => 'misc/legends',
  256.                  'ModCP'    => 'mod_cp',
  257.                );
  258.  
  259.                 
  260. /***************************************************/
  261.  
  262. $ibforums->input['act'] = $ibforums->input['act'] == '' ? "idx" : $ibforums->input['act'];
  263.  
  264. // Check to make sure the array key exits..
  265.  
  266. if (! isset($choice[ $ibforums->input['act'] ]) )
  267. {
  268.     $ibforums->input['act'] = 'idx';
  269. }
  270.  
  271. // Require and run
  272.  
  273. require $root_path."sources/".$choice[ $ibforums->input['act'] ].".php";
  274.  
  275.  
  276.  
  277. //+-------------------------------------------------
  278. // GLOBAL ROUTINES
  279. //+-------------------------------------------------
  280.  
  281. function fatal_error($message="", $help="") {
  282.     echo("$message<br><br>$help");
  283.     exit;
  284. }
  285. ?>
  286.